package com.yonyou.cyxdms.basedata.service.entity.code;

import com.baomidou.mybatisplus.annotation.*;
import com.yonyou.cyx.function.utils.bean.BeanMapperUtil;
import com.yonyou.cyxdms.framework.bean.dto.base.DMSBaseDTO;
import com.yonyou.cyxdms.framework.bean.entity.base.DMSBasePO;

import java.time.LocalDateTime;


/**
 * <p>
 * 系统固定代码
 * </p>
 *
 * @author renwd
 * @since 2018-12-12
 */
@TableName("tc_code")
public class CodePO extends DMSBasePO<CodePO> {

    private static final long serialVersionUID = 1L;

    /**
     * 代码ID
     */
    @TableField(value = "CODE_ID")
    private Integer codeId;


    /**
     * APP_ID
     */
    @TableField("APP_ID")
    private String appId;

    /**
     * 代码类型(取CODE_ID前4位)
     */
    @TableField("TYPE")
    private Integer type;

    /**
     * 类型名称
     */
    @TableField("TYPE_NAME")
    private String typeName;


    /**
     * 代码英文名称
     */
    @TableField("CODE_EN_DESC")
    private String codeEnDesc;


    /**
     * 代码中文名称
     */
    @TableField("CODE_CN_DESC")
    private String codeCnDesc;

    /**
     * 排序
     */
    @TableField("NUM")
    private Integer num;

    /**
     * 状态(10011001有效,10011002无效)
     */
    @TableField("STATUS")
    private Integer status;

    /**
     * 是否删除(0:未删除1:删除)
     */
    @TableField("IS_DELETED")
    @Version
    private Boolean isDeleted;

    @TableField("CREATED_BY")
    private String createdBy;

    @TableField("UPDATED_BY")
    private String updatedBy;

    @TableField("CREATED_AT")
    private LocalDateTime createdAt;

    @TableField("UPDATED_AT")
    private LocalDateTime updatedAt;

    public Boolean getDeleted() {
        return isDeleted;
    }

    public void setDeleted(Boolean isDeleted) {
        this.isDeleted = isDeleted;
    }

    public Integer getCodeId() {
        return codeId;
    }

    public void setCodeId(Integer codeId) {
        this.codeId = codeId;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getTypeName() {
        return typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    public String getCodeEnDesc() {
        return codeEnDesc;
    }

    public void setCodeEnDesc(String codeEnDesc) {
        this.codeEnDesc = codeEnDesc;
    }

    public String getCodeCnDesc() {
        return codeCnDesc;
    }

    public void setCodeCnDesc(String codeCnDesc) {
        this.codeCnDesc = codeCnDesc;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Override
    public String getCreatedBy() {
        return createdBy;
    }

    @Override
    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    @Override
    public String getUpdatedBy() {
        return updatedBy;
    }

    @Override
    public void setUpdatedBy(String updatedBy) {
        this.updatedBy = updatedBy;
    }

    @Override
    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    @Override
    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    @Override
    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    @Override
    public String toString() {
        return "CodePO{" +
                "codeId=" + codeId +
                ", appId='" + appId + '\'' +
                ", type=" + type +
                ", typeName='" + typeName + '\'' +
                ", codeEnDesc='" + codeEnDesc + '\'' +
                ", codeCnDesc='" + codeCnDesc + '\'' +
                ", num=" + num +
                ", status=" + status +
                ", createdBy=" + createdBy +
                ", createdAt=" + createdAt +
                ", updatedBy=" + updatedBy +
                ", updatedAt=" + updatedAt +
                '}';
    }

    /**
     * 将PO 信息转化为DTO
     *
     * @param dto 需要进行转换的dto
     * @author renwd
     * @since 2018/7/22 0022
     */
    protected <T extends DMSBaseDTO> void transDtoToPo(T dto) {
        BeanMapperUtil.copyProperties(this, dto, "codeId");
    }


}
